import { ADD_SHORTCUT, DELETE_SHORTCUT } from "../const/list.const"

const initialState = {
  totalCount: 0,
  list: []
}
export default function (state = initialState, action){
  switch(action.type){
    case ADD_SHORTCUT: {
      return {
        lists: {
          list: state.list.concat([action.payload]),
          totalCount: state.totalCount + 1
        }
      }
    }
    case DELETE_SHORTCUT: {
      return {
        lists: action.payload
      }
    }
    default: {
      return state
    }
  }
}